home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pgpwin11 / pgpc.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  6.4 KB  |  240 lines

  1. VERSION 2.00
  2. Begin Form pgpc 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "PGP Composer ver 1.1"
  5.    ClientHeight    =   6840
  6.    ClientLeft      =   -90
  7.    ClientTop       =   450
  8.    ClientWidth     =   9435
  9.    FontBold        =   -1  'True
  10.    FontItalic      =   0   'False
  11.    FontName        =   "Futura Md BT"
  12.    FontSize        =   8.25
  13.    FontStrikethru  =   0   'False
  14.    FontUnderline   =   0   'False
  15.    Height          =   7245
  16.    Icon            =   PGPC.FRX:0000
  17.    Left            =   -150
  18.    LinkMode        =   1  'Source
  19.    LinkTopic       =   "Form1"
  20.    MaxButton       =   0   'False
  21.    ScaleHeight     =   6840
  22.    ScaleWidth      =   9435
  23.    Top             =   105
  24.    Width           =   9555
  25.    Begin TextBox signas 
  26.       Enabled         =   0   'False
  27.       Height          =   375
  28.       Left            =   6600
  29.       TabIndex        =   9
  30.       Top             =   6240
  31.       Width           =   2655
  32.    End
  33.    Begin CommandButton Command1 
  34.       Caption         =   "&Go"
  35.       Height          =   375
  36.       Left            =   7920
  37.       TabIndex        =   2
  38.       Top             =   5760
  39.       Width           =   1335
  40.    End
  41.    Begin PictureBox Picture1 
  42.       BorderStyle     =   0  'None
  43.       Height          =   495
  44.       Left            =   7200
  45.       Picture         =   PGPC.FRX:0302
  46.       ScaleHeight     =   495
  47.       ScaleWidth      =   615
  48.       TabIndex        =   10
  49.       Top             =   5760
  50.       Width           =   615
  51.    End
  52.    Begin CheckBox issign 
  53.       Caption         =   "&Sign [as]"
  54.       Height          =   255
  55.       Left            =   6600
  56.       TabIndex        =   3
  57.       Top             =   5640
  58.       Width           =   1215
  59.    End
  60.    Begin CommandButton rereadkeys 
  61.       Caption         =   "ReRead &Keys"
  62.       Height          =   375
  63.       Left            =   7920
  64.       TabIndex        =   8
  65.       Top             =   5280
  66.       Width           =   1335
  67.    End
  68.    Begin CheckBox ismore 
  69.       Caption         =   "&Eyes Only"
  70.       Height          =   255
  71.       Left            =   6600
  72.       TabIndex        =   4
  73.       Top             =   5280
  74.       Width           =   1215
  75.    End
  76.    Begin Timer Timer1 
  77.       Interval        =   1000
  78.       Left            =   9600
  79.       Top             =   1800
  80.    End
  81.    Begin ListBox hexlist 
  82.       Height          =   3150
  83.       Left            =   9240
  84.       TabIndex        =   6
  85.       Top             =   960
  86.       Visible         =   0   'False
  87.       Width           =   1815
  88.    End
  89.    Begin ListBox textlist 
  90.       Height          =   4515
  91.       Left            =   6600
  92.       TabIndex        =   5
  93.       Top             =   600
  94.       Width           =   2775
  95.    End
  96.    Begin TextBox pad 
  97.       FontBold        =   -1  'True
  98.       FontItalic      =   0   'False
  99.       FontName        =   "System"
  100.       FontSize        =   9.75
  101.       FontStrikethru  =   0   'False
  102.       FontUnderline   =   0   'False
  103.       Height          =   6015
  104.       Left            =   120
  105.       MultiLine       =   -1  'True
  106.       TabIndex        =   1
  107.       Top             =   600
  108.       Width           =   6375
  109.    End
  110.    Begin TextBox recepients 
  111.       Height          =   375
  112.       Left            =   960
  113.       TabIndex        =   0
  114.       Top             =   120
  115.       Width           =   8415
  116.    End
  117.    Begin Label Label1 
  118.       Caption         =   "To:"
  119.       Height          =   255
  120.       Left            =   120
  121.       TabIndex        =   7
  122.       Top             =   120
  123.       Width           =   615
  124.    End
  125. Dim stage As Integer
  126. Sub Command1_Click ()
  127.     Open "plaintmp.$$$" For Output As #1
  128.     Print #1, pad.text
  129.     Close (1)
  130.     On Local Error Resume Next
  131.     Kill "enc$tmp.$$$"
  132.     flags$ = "wa"
  133.     rec$ = LTrim$(RTrim$(recepients.text))
  134.     If issign.value Then
  135.         flags$ = flags$ + "s"
  136.         signuser$ = LTrim$(RTrim$(signas.text))
  137.     End If
  138.     If ismore.value Then flags$ = flags$ + "m"
  139.     If rec$ <> "" Then flags$ = flags$ + "e"
  140.     If issign.value And signuser$ <> "" Then
  141.     flags$ = flags$ + " -u """ + signuser$ + """"
  142.     End If
  143.     pgpc.caption = "Launching PGP..."
  144.     screen.pointer = 11
  145.     i% = Shell("pgpcomp.pif " + flags$ + " " + rec$, 1)
  146.     stage = 4
  147. End Sub
  148. Sub Form_Load ()
  149.     screen.mousepointer = 11
  150.     stage = 3 ' first, we assume have pgpk$tmp.$$$
  151. End Sub
  152. Sub getkeys ()
  153.     Do While textlist.listcount
  154.         textlist.RemoveItem 0
  155.         hexlist.RemoveItem 0
  156.     Loop
  157.     If stage = 3 Then
  158.         stage = 0
  159.         On Local Error GoTo nokey3
  160.         Open "pgpk$tmp.$$$" For Input As #1
  161.         While Not EOF(1)
  162.             Input #1, l$
  163.             If Left$(l$, 4) = "pub " Then
  164.                 textlist.AddItem (Mid$(l$, 30))
  165.                 hexlist.AddItem (Mid$(l$, 11, 6))
  166.             End If
  167.         Wend
  168.         Close (1)
  169.         pgpc.caption = "PGP Composer ver 1.1" ' restore just in case.
  170.         screen.mousepointer = 0
  171.     End If
  172.     GoTo fin3
  173. nokey3:
  174.     stage = 1
  175.     Resume fin3
  176. fin3:
  177. End Sub
  178. Sub issign_Click ()
  179.     signas.enabled = issign.value
  180. End Sub
  181. Sub launchkeys ()
  182.     If stage = 1 Then
  183.         stage = 0
  184.         pgpc.caption = "Scanning Keyring..."
  185.         i% = Shell("pgpkeys.pif -kv", 2)
  186.         stage = 2
  187.     End If
  188. End Sub
  189. Sub rereadkeys_Click ()
  190.     On Local Error Resume Next
  191.     Kill "pgpk$tmp.$$$"
  192.     stage = 1
  193. End Sub
  194. Sub textlist_DblClick ()
  195.     recepients.text = LTrim$(RTrim$(recepients.text)) + " 0x" + hexlist.list(textlist.listindex)
  196.     pad.SetFocus
  197. End Sub
  198. Sub Timer1_Timer ()
  199.     Select Case stage
  200.         Case 1
  201.             launchkeys
  202.         Case 2
  203.             waitforkeys
  204.         Case 3
  205.             getkeys
  206.         Case 4
  207.             stage = 5 ' buy some time
  208.         Case 5
  209.             waitforenc
  210.     End Select
  211. End Sub
  212. Sub waitforenc ()
  213.     If stage = 5 Then
  214.         stage = 0
  215.         On Local Error GoTo notyet5
  216.         Open "enc$tmp.$$$" For Input As #1
  217.         Close (1)
  218.         i% = Shell("notepad enc$tmp.$$$", 1)
  219.         End
  220.     End If
  221. notyet5:
  222.         stage = 5
  223.         Resume fin5
  224. fin5:
  225. End Sub
  226. Sub waitforkeys ()
  227.     If stage = 2 Then
  228.         stage = 0
  229.         On Local Error GoTo notyet2
  230.         Open "pgpk$tmp.$$$" For Input As #1
  231.         stage = 3
  232.         Close (1)
  233.         GoTo fin2
  234. notyet2:
  235.     stage = 2
  236.     Resume fin2
  237. fin2:
  238.     End If
  239. End Sub
  240.